<html>
    <body>
    <?php
        $conn = mysql_connect('vergil.u.washington.edu:10000','root','445db');
        if(!$conn) {
            die('Could not connect: '.mysql_error());
        }
        echo 'Connected to server.',"<br>\n";
        
        $current_db = mysql_select_db('test',$conn);
        if (!$current_db) {
            die('Could not use test: '.mysql_error()."\n");
        }
        echo 'Using test db.',"<br>\n";
        
        $user = $_POST["usr"];
        
        echo $user,"<br>\n";
        
        $result = mysql_query("SELECT * FROM login"/* WHERE username='$user'"*/);
        if(!$result) {
            die('Query unsuccessful. '.mysql_error()."\n");
        } 
        echo 'Query Successful.',"<br><br>";
        
        while($row=mysql_fetch_row($result)){
            if($_POST["usr"]==$row[0] && $_POST["pass"]==$row[1]){
                echo 'Login Successful.';
            }
        }
        /*
        echo "<b>Results</b><br><br>";
        
        echo
        "<table border='1px' >".
        
            "<tr>".
                "<th>Username</th>".
                "<th>Password</th>".
                "<th>Role</th>".
            "</tr>";
        
        while($row=mysql_fetch_row($result)){
            echo "<tr>".
                "<th>$row[0]</th>".
                "<th>$row[1]</th>".
                "<th>$row[2]</th>".

            "</tr>";
        }
        echo "</table>";
        */
         
        mysql_close($conn);
    ?>
    </body>
</html>